﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace RilattackLibrary
{
    public class Scene
    {
        private static Scene _instance;
        public static Scene Instance
        {
            get
            {
                if(_instance == null)
                {
                    _instance = new Scene();
                }
                return _instance;
            }
        }

        public void Initialize()
        {
            Actors = new List<Actor>();
            Actors = Actors.Concat(Map.Instance.CreateMapElements(Textures["tiles1"], 16, 16, 1.0)).ToList();
        }

        public void AddPlayer(Player p)
        {
            p.Image = Textures["Worms/wblink1"];
            p.Source = new Rectangle(0, 0, 60, 60);
            //p.Dest = new Rectangle(64, 64, 60, 60);
            Actors.Add(p);
        }

        public Dictionary<string, Texture2D> Textures = new Dictionary<string, Texture2D>();

        public List<RilattackLibrary.Actor> Actors
        {
            get; set;
        }

        public GameConfiguration GameConfiguration
        {
            get; set;
        }

        public void Act(SpriteBatch spriteBatch)
        {
            foreach(Actor actor in Actors)
            {
                actor.Play(spriteBatch);
            }
        }
    }
}